package com.xwh.week3;

public class Practice1 {
    static int[]a=new int[10000];
    public static long add1(int n){
        long t=0;
        for(int i=1;i<=n;i++){
            if(prime(prime(i))==i&&i!=prime(i)&&a[i]!=-1){
                t+=(i+prime(i));
                a[i]=-1;
                a[prime(i)]=-1;
            }
        }
        return t;
    }
    public static int prime(int n){
        int t=1;
        for(int i=2;i*i<=n;i++){
            if(n%i==0&&i*i!=n) t+=(i+n/i);
            else if(n%i==0&&i*i==n) t+=i;
        }
        return t;
    }
    public static void main(String[] args) {
        System.out.println(add1(10000));
    }


}
